<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<link href="css/redmond/jquery-ui-1.10.3.custom.min.css" rel="stylesheet" type="text/css">	<!-- jquery UI CSS -->
<link href="css/selfTemplate.css" rel="stylesheet" type="text/css">							<!-- homemade CSS -->

<script src="js/jquery-2.1.0.min.js" type="text/javascript"></script>						<!-- jquery -->
<script src="js/jquery-ui-1.10.3.custom.js" type="text/javascript"></script>				<!-- jquery UI -->
<script src="js/jquery.cookie.js" type="text/javascript"></script>							<!-- cookie -->
<script src="js/widgets.js" type="text/javascript"></script>								<!-- homemade js -->

<script type="text/javascript">
var toDoListId = 0;
//主管按下同意或拒絕的鈕
function reply(obj,isApprove) {
	clearErrorMsg();
	windowFreeze("執行中..");
	
	$("button").prop("disabled",true);	//將操作的按鈕給disable
	var actType = "add";
	if( $("#audi").html() == "修改" ) {
		actType = "update";
	}
	
	
	$.ajax({ type:"post",url:"ApproveQuartz",dataType:"text",async:false,
		data: {
			toDoListId:toDoListId,
			empId:$.cookie("empId"),
			quartzJobId:$("#quartzJobId").html(),
			actType:actType,
			isApprove:isApprove
		}, success : function(reses) {
			$("button.reply").remove();
			$("tr.review > td:first").append("<button id='backToDoList' type='button' onclick=\"window.location='toDoList.html'\">回到待辦事項</button>");
			$("#backToDoList").button();
		}, error : function(xhr, ajaxOptions, thrownError) { errorAjx(xhr); }
	});
	windowUnfreeze();
}

$(document).ready(function() {	
	init("reviewQuartz.html");
	var itemType = $.cookie("itemType");
	var dif = JSON.parse( $.cookie("rqca") );
	toDoListId = $.cookie("toDoListId");
	
	$.removeCookie("rqca");				//儲存模組的基本資料
	$.removeCookie("toDoListId");
	$.removeCookie("itemType");
	
	var subsys = dif.subsysDesc + "(" + dif.subsysId + ")";
	
	$("#quartzJobId").html( dif.quartzJobId );
	
	var isDailyBuild = "";
	var audi ="新申請";
	if( dif.originalQuartzJobId!=0 ) {
		audi ="修改";
		//$("#originalQuartzJobId").val( dif.originalQuartzJobId );
	}
	$("#audi").html( audi );
	$("#quartzJobTypeDesc").html( dif.quartzJobTypeDesc );
	$("#cronString").html( dif.cronString );
	$("#subsys").html( subsys );
	$("#applier").html( dif.empName );
	$("#cdt").html( dif.cDT );
	
	$("button").button();
});
</script>

</head>
<body>
<div id="header"></div>		<!-- 畫面抬頭 -->
<p>
<table>
	<thead class="tableFirst">
		<tr class="review">
			<td class="right">
				<button class="zhTwN reply" type="button" id="btnAgree" onclick="reply(this,1)">同意</button>
				<button class="zhTwN reply" type="button" id="btnDisagree" onclick="reply(this,0)">拒絕</button>
			</td>
			<td class="left zhTwN">說明：<input type="text"></td>
		</tr>
		<tr><th class="right">排程申請代號：</th><td id="quartzJobId" class="int"></td></tr>
		<tr><th class="right">排程類型：</th><td bgcolor="#EAF4FD" id="quartzJobTypeDesc" class="zhTwN left"></td></tr>
		<tr><th class="right">增、刪、改：</th><td id="audi" class="zhTwN left"></td></tr>
		<tr><th class="right">執行公式：</th><td id="cronString" class="zhTwN left"></td></tr>
		<tr><th class="right">系統：</th><td bgcolor="#EAF4FD" id="subsys" class="zhTwN left"></td></tr>
		<tr><th class="right">繳交人員：</th><td id="applier" class="zhTwN left"></td></tr>
		<tr><th class="right">申請時間：</th><td bgcolor="#EAF4FD" id="cdt" class="left engN"></td></tr>
	</thead>
</table>
<input type="hidden" id="originalQuartzJobId" value=0>
<p>
<p>
</body>
</html>